{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ad365521",
   "metadata": {},
   "source": [
    "## 第二周\n",
    "\n",
    "### 1.github education packages\n",
    "* 注册\n",
    "\n",
    "### 2.下载安装pycharm，学习安装jupyter notebook\n",
    "\n",
    "### 3.学习jupyter notebook的使用\n",
    "* 查看[官网](http://jupyter.org/)\n",
    "* 通过cmd打开jupyter notebook\n",
    "* 使用jupyter notebook整理学习内容"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7fc470a9",
   "metadata": {},
   "source": [
    "### 4.Python项目一，奇数中选择指定的时间minute"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "879162b5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,57,59]\n",
    "right_this_minute = datetime.today().minute\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "285037b7",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-09-18T05:52:33.035564Z",
     "start_time": "2021-09-18T05:50:10.022384Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n",
      "Not an odd minute.\n",
      "Not an odd minute.\n",
      "This minute seems a little odd.\n",
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "import random\n",
    "import time\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,57,59]\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today().minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd minute.\")\n",
    "    wait_time = random.randint(1,60)\n",
    "    time.sleep(wait_time)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2aa5971c",
   "metadata": {},
   "source": [
    "### 5.观察标准库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0632bea3",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:28:16.963883Z",
     "start_time": "2021-10-08T12:28:16.923881Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'win32'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 属性\n",
    "import sys\n",
    "sys.platform"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "746a0c43",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:39:56.660903Z",
     "start_time": "2021-10-08T12:39:56.644902Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]\n"
     ]
    }
   ],
   "source": [
    "# python版本\n",
    "print(sys.version)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b34ee23e",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:40:51.226024Z",
     "start_time": "2021-10-08T12:40:51.201023Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\Administrator\\\\2021Python\\\\Python\\\\week02'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 笔记保存路径？\n",
    "import os\n",
    "os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "58d1dae2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:49:29.126646Z",
     "start_time": "2021-10-08T12:49:29.072643Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "environ{'ALLUSERSPROFILE': 'C:\\\\ProgramData',\n",
       "        'APPDATA': 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming',\n",
       "        'COMMONPROGRAMFILES': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMMONPROGRAMFILES(X86)': 'C:\\\\Program Files (x86)\\\\Common Files',\n",
       "        'COMMONPROGRAMW6432': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMPUTERNAME': 'WAK-20180227KKH',\n",
       "        'COMSPEC': 'C:\\\\Windows\\\\system32\\\\cmd.exe',\n",
       "        'C_EM64T_REDIST11': 'C:\\\\Program Files (x86)\\\\Common Files\\\\Intel\\\\Shared Files\\\\cpp\\\\',\n",
       "        'FP_NO_HOST_CHECK': 'NO',\n",
       "        'HOMEDRIVE': 'C:',\n",
       "        'HOMEPATH': '\\\\Users\\\\Administrator',\n",
       "        'INTEL_DEV_REDIST': 'C:\\\\Program Files (x86)\\\\Common Files\\\\Intel\\\\Shared Libraries\\\\',\n",
       "        'LOCALAPPDATA': 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Local',\n",
       "        'LOGONSERVER': '\\\\\\\\WAK-20180227KKH',\n",
       "        'MIC_LD_LIBRARY_PATH': 'C:\\\\Program Files (x86)\\\\Common Files\\\\Intel\\\\Shared Libraries\\\\compiler\\\\lib\\\\mic',\n",
       "        'NUMBER_OF_PROCESSORS': '4',\n",
       "        'OS': 'Windows_NT',\n",
       "        'PATH': 'D:\\\\Anaconda;D:\\\\Python\\\\Scripts;D:Anaconda\\\\Library\\\\bin;D:\\\\Anaconda\\\\Scripts;D:\\\\Anaconda\\\\Library\\\\bin;D:\\\\Anaconda\\\\Library\\\\mingw-w64\\\\bin;C:\\\\Program Files\\\\PuTTY\\\\c:\\\\windows\\\\system32\\\\;C:\\\\Windows\\\\system32',\n",
       "        'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',\n",
       "        'PROCESSOR_ARCHITECTURE': 'AMD64',\n",
       "        'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel',\n",
       "        'PROCESSOR_LEVEL': '6',\n",
       "        'PROCESSOR_REVISION': '3c03',\n",
       "        'PROGRAMDATA': 'C:\\\\ProgramData',\n",
       "        'PROGRAMFILES': 'C:\\\\Program Files',\n",
       "        'PROGRAMFILES(X86)': 'C:\\\\Program Files (x86)',\n",
       "        'PROGRAMW6432': 'C:\\\\Program Files',\n",
       "        'PROMPT': '$P$G',\n",
       "        'PSMODULEPATH': 'C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\Modules\\\\',\n",
       "        'PUBLIC': 'C:\\\\Users\\\\Public',\n",
       "        'PYCHARM': 'D:\\\\PyCharm 2021.2.1\\\\bin;',\n",
       "        'SESSIONNAME': 'Console',\n",
       "        'SYSTEMDRIVE': 'C:',\n",
       "        'SYSTEMROOT': 'C:\\\\Windows',\n",
       "        'TEMP': 'C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp',\n",
       "        'TMP': 'C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp',\n",
       "        'USERDOMAIN': 'WAK-20180227KKH',\n",
       "        'USERNAME': 'Administrator',\n",
       "        'USERPROFILE': 'C:\\\\Users\\\\Administrator',\n",
       "        'WINDIR': 'C:\\\\Windows',\n",
       "        'WINDOWS_TRACING_FLAGS': '3',\n",
       "        'WINDOWS_TRACING_LOGFILE': 'C:\\\\BVTBin\\\\Tests\\\\installpackage\\\\csilogfile.log',\n",
       "        '_DFX_INSTALL_UNSIGNED_DRIVER': '1',\n",
       "        'JPY_INTERRUPT_EVENT': '2112',\n",
       "        'IPY_INTERRUPT_EVENT': '2112',\n",
       "        'JPY_PARENT_PID': '2128',\n",
       "        'TERM': 'xterm-color',\n",
       "        'CLICOLOR': '1',\n",
       "        'PAGER': 'cat',\n",
       "        'GIT_PAGER': 'cat',\n",
       "        'MPLBACKEND': 'module://ipykernel.pylab.backend_inline'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.environ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "36f56aa1",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:50:32.816289Z",
     "start_time": "2021-10-08T12:50:32.797288Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2021, 10, 8)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 今日日期\n",
    "import datetime\n",
    "datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "59a6b2af",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:52:12.687001Z",
     "start_time": "2021-10-08T12:52:12.653000Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2021"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 今日日期中单独的年\n",
    "datetime.date.today().year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "23af636b",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:52:45.701890Z",
     "start_time": "2021-10-08T12:52:45.663888Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 今日日期中单独的月\n",
    "datetime.date.today().month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0a1e4fe8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:53:09.097228Z",
     "start_time": "2021-10-08T12:53:09.069226Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 今日日期中单独的日\n",
    "datetime.date.today().day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b1e9d901",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T12:56:59.192389Z",
     "start_time": "2021-10-08T12:56:59.168387Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2021-10-08'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 字符串形式显示日期\n",
    "datetime.date.isoformat(datetime.date.today())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "f9cc7743",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:00:45.733346Z",
     "start_time": "2021-10-08T13:00:45.711345Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'21:00'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 24小时制时间\n",
    "import time\n",
    "time.strftime(\"%H:%M\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d5e7381a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:06:23.289653Z",
     "start_time": "2021-10-08T13:06:23.257651Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Friday PM'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 周几 上下午\n",
    "time.strftime(\"%A %p\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "7eb01c6e",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:13:35.295362Z",
     "start_time": "2021-10-08T13:13:35.238359Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'This HTML fragment contains a &lt;script&gt;script&lt;/script&gt;tag.'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 与HTML编码文本的来回转换\n",
    "import html\n",
    "html.escape(\"This HTML fragment contains a <script>script</script>tag.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "5db0f6ff",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:13:41.686728Z",
     "start_time": "2021-10-08T13:13:41.656726Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'I ♥ <myself>.'"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "html.unescape(\"I &hearts; &lt;myself&gt;.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d57c91a3",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-09T12:05:52.787307Z",
     "start_time": "2021-10-09T12:05:52.701302Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'today' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-4-e407ffefc1b3>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m# 缩进\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mif\u001b[0m \u001b[0mtoday\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'Saturday'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      4\u001b[0m     \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'放假了'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mtoday\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'Sunday'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'today' is not defined"
     ]
    }
   ],
   "source": [
    "# 缩进\n",
    "import time\n",
    "if today == 'Saturday':\n",
    "    print('放假了')\n",
    "elif today == 'Sunday':\n",
    "    if condition == '头疼':\n",
    "        print('休息休息')\n",
    "    else:\n",
    "        print('休息')\n",
    "else:\n",
    "    print('工作')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "011f04fa",
   "metadata": {},
   "source": [
    "### 6.序列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "0603f8ba",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:38:45.445738Z",
     "start_time": "2021-10-08T13:38:45.421737Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in [1,2,3]:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "e21639e8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:41:35.146444Z",
     "start_time": "2021-10-08T13:41:35.125443Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "H\n",
      "i\n",
      "!\n"
     ]
    }
   ],
   "source": [
    "for ch in \"Hi!\":\n",
    "    print(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "cb57269f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:43:13.906093Z",
     "start_time": "2021-10-08T13:43:13.861091Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n"
     ]
    }
   ],
   "source": [
    "for num in range(5):\n",
    "    print('Head First Rocks!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "41642f1b",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:46:05.420903Z",
     "start_time": "2021-10-08T13:46:05.387901Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n",
      "Not an odd minute.\n",
      "Not an odd minute.\n",
      "Not an odd minute.\n",
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,57,59]\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today().minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd\")\n",
    "    else:\n",
    "        print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "469677a7",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:47:14.616861Z",
     "start_time": "2021-10-08T13:47:09.609575Z"
    }
   },
   "outputs": [],
   "source": [
    "import time\n",
    "time.sleep(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7b937f18",
   "metadata": {},
   "source": [
    "### 7.随机整数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "a6eb3fcc",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:48:41.891853Z",
     "start_time": "2021-10-08T13:48:41.873852Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method randint in module random:\n",
      "\n",
      "randint(a, b) method of random.Random instance\n",
      "    Return random integer in range [a, b], including both end points.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# 随机数\n",
    "import random\n",
    "help(random.randint)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "51c6e03d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:50:13.789109Z",
     "start_time": "2021-10-08T13:50:13.754107Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "48"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(1,60)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "2416aa0d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:50:28.031924Z",
     "start_time": "2021-10-08T13:50:28.013923Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(1,60)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "b8a217ab",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:50:32.781195Z",
     "start_time": "2021-10-08T13:50:32.760194Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "21"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(1,60)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab852b26",
   "metadata": {},
   "source": [
    "### 8.Range "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "8916d93b",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:53:22.852923Z",
     "start_time": "2021-10-08T13:53:22.815921Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class range in module builtins:\n",
      "\n",
      "class range(object)\n",
      " |  range(stop) -> range object\n",
      " |  range(start, stop[, step]) -> range object\n",
      " |  \n",
      " |  Return an object that produces a sequence of integers from start (inclusive)\n",
      " |  to stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.\n",
      " |  start defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.\n",
      " |  These are exactly the valid indices for a list of 4 elements.\n",
      " |  When step is given, it specifies the increment (or decrement).\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __bool__(self, /)\n",
      " |      self != 0\n",
      " |  \n",
      " |  __contains__(self, key, /)\n",
      " |      Return key in self.\n",
      " |  \n",
      " |  __eq__(self, value, /)\n",
      " |      Return self==value.\n",
      " |  \n",
      " |  __ge__(self, value, /)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __getattribute__(self, name, /)\n",
      " |      Return getattr(self, name).\n",
      " |  \n",
      " |  __getitem__(self, key, /)\n",
      " |      Return self[key].\n",
      " |  \n",
      " |  __gt__(self, value, /)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __hash__(self, /)\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __iter__(self, /)\n",
      " |      Implement iter(self).\n",
      " |  \n",
      " |  __le__(self, value, /)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __len__(self, /)\n",
      " |      Return len(self).\n",
      " |  \n",
      " |  __lt__(self, value, /)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  __ne__(self, value, /)\n",
      " |      Return self!=value.\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __repr__(self, /)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  __reversed__(...)\n",
      " |      Return a reverse iterator.\n",
      " |  \n",
      " |  count(...)\n",
      " |      rangeobject.count(value) -> integer -- return number of occurrences of value\n",
      " |  \n",
      " |  index(...)\n",
      " |      rangeobject.index(value) -> integer -- return index of value.\n",
      " |      Raise ValueError if the value is not present.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  start\n",
      " |  \n",
      " |  step\n",
      " |  \n",
      " |  stop\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(range)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "d7931c8a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:56:41.116263Z",
     "start_time": "2021-10-08T13:56:41.062260Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(0, 5)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "a4b22488",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:57:12.161039Z",
     "start_time": "2021-10-08T13:57:12.123036Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "f0b56b92",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T13:58:53.745849Z",
     "start_time": "2021-10-08T13:58:53.710847Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调整range的开始和停止值\n",
    "list(range(5,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "59016a5a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T14:00:18.865718Z",
     "start_time": "2021-10-08T14:00:18.829715Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 2, 4, 6, 8]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 设置range步长(开始，停止，步长)\n",
    "list(range(0,10,2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "f940d191",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T14:01:48.488844Z",
     "start_time": "2021-10-08T14:01:48.466842Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[10, 8, 6, 4, 2]"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 设置负数步长\n",
    "list(range(10,0,-2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "326f4b21",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-08T14:02:24.851924Z",
     "start_time": "2021-10-08T14:02:24.811921Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[99,\n",
       " 98,\n",
       " 97,\n",
       " 96,\n",
       " 95,\n",
       " 94,\n",
       " 93,\n",
       " 92,\n",
       " 91,\n",
       " 90,\n",
       " 89,\n",
       " 88,\n",
       " 87,\n",
       " 86,\n",
       " 85,\n",
       " 84,\n",
       " 83,\n",
       " 82,\n",
       " 81,\n",
       " 80,\n",
       " 79,\n",
       " 78,\n",
       " 77,\n",
       " 76,\n",
       " 75,\n",
       " 74,\n",
       " 73,\n",
       " 72,\n",
       " 71,\n",
       " 70,\n",
       " 69,\n",
       " 68,\n",
       " 67,\n",
       " 66,\n",
       " 65,\n",
       " 64,\n",
       " 63,\n",
       " 62,\n",
       " 61,\n",
       " 60,\n",
       " 59,\n",
       " 58,\n",
       " 57,\n",
       " 56,\n",
       " 55,\n",
       " 54,\n",
       " 53,\n",
       " 52,\n",
       " 51,\n",
       " 50,\n",
       " 49,\n",
       " 48,\n",
       " 47,\n",
       " 46,\n",
       " 45,\n",
       " 44,\n",
       " 43,\n",
       " 42,\n",
       " 41,\n",
       " 40,\n",
       " 39,\n",
       " 38,\n",
       " 37,\n",
       " 36,\n",
       " 35,\n",
       " 34,\n",
       " 33,\n",
       " 32,\n",
       " 31,\n",
       " 30,\n",
       " 29,\n",
       " 28,\n",
       " 27,\n",
       " 26,\n",
       " 25,\n",
       " 24,\n",
       " 23,\n",
       " 22,\n",
       " 21,\n",
       " 20,\n",
       " 19,\n",
       " 18,\n",
       " 17,\n",
       " 16,\n",
       " 15,\n",
       " 14,\n",
       " 13,\n",
       " 12,\n",
       " 11,\n",
       " 10,\n",
       " 9,\n",
       " 8,\n",
       " 7,\n",
       " 6,\n",
       " 5,\n",
       " 4,\n",
       " 3,\n",
       " 2,\n",
       " 1]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(99,0,-1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "550f6e61",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-09-18T05:54:13.503310Z",
     "start_time": "2021-09-18T05:54:13.438307Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 bottle of beer on the wall.\n",
      "99 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "98 bottle of beer on the wall.\n",
      "\n",
      "98 bottle of beer on the wall.\n",
      "98 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "97 bottle of beer on the wall.\n",
      "\n",
      "97 bottle of beer on the wall.\n",
      "97 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "96 bottle of beer on the wall.\n",
      "\n",
      "96 bottle of beer on the wall.\n",
      "96 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "95 bottle of beer on the wall.\n",
      "\n",
      "95 bottle of beer on the wall.\n",
      "95 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "94 bottle of beer on the wall.\n",
      "\n",
      "94 bottle of beer on the wall.\n",
      "94 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "93 bottle of beer on the wall.\n",
      "\n",
      "93 bottle of beer on the wall.\n",
      "93 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "92 bottle of beer on the wall.\n",
      "\n",
      "92 bottle of beer on the wall.\n",
      "92 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "91 bottle of beer on the wall.\n",
      "\n",
      "91 bottle of beer on the wall.\n",
      "91 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "90 bottle of beer on the wall.\n",
      "\n",
      "90 bottle of beer on the wall.\n",
      "90 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "89 bottle of beer on the wall.\n",
      "\n",
      "89 bottle of beer on the wall.\n",
      "89 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "88 bottle of beer on the wall.\n",
      "\n",
      "88 bottle of beer on the wall.\n",
      "88 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "87 bottle of beer on the wall.\n",
      "\n",
      "87 bottle of beer on the wall.\n",
      "87 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "86 bottle of beer on the wall.\n",
      "\n",
      "86 bottle of beer on the wall.\n",
      "86 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "85 bottle of beer on the wall.\n",
      "\n",
      "85 bottle of beer on the wall.\n",
      "85 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "84 bottle of beer on the wall.\n",
      "\n",
      "84 bottle of beer on the wall.\n",
      "84 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "83 bottle of beer on the wall.\n",
      "\n",
      "83 bottle of beer on the wall.\n",
      "83 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "82 bottle of beer on the wall.\n",
      "\n",
      "82 bottle of beer on the wall.\n",
      "82 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "81 bottle of beer on the wall.\n",
      "\n",
      "81 bottle of beer on the wall.\n",
      "81 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "80 bottle of beer on the wall.\n",
      "\n",
      "80 bottle of beer on the wall.\n",
      "80 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "79 bottle of beer on the wall.\n",
      "\n",
      "79 bottle of beer on the wall.\n",
      "79 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "78 bottle of beer on the wall.\n",
      "\n",
      "78 bottle of beer on the wall.\n",
      "78 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "77 bottle of beer on the wall.\n",
      "\n",
      "77 bottle of beer on the wall.\n",
      "77 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "76 bottle of beer on the wall.\n",
      "\n",
      "76 bottle of beer on the wall.\n",
      "76 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "75 bottle of beer on the wall.\n",
      "\n",
      "75 bottle of beer on the wall.\n",
      "75 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "74 bottle of beer on the wall.\n",
      "\n",
      "74 bottle of beer on the wall.\n",
      "74 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "73 bottle of beer on the wall.\n",
      "\n",
      "73 bottle of beer on the wall.\n",
      "73 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "72 bottle of beer on the wall.\n",
      "\n",
      "72 bottle of beer on the wall.\n",
      "72 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "71 bottle of beer on the wall.\n",
      "\n",
      "71 bottle of beer on the wall.\n",
      "71 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "70 bottle of beer on the wall.\n",
      "\n",
      "70 bottle of beer on the wall.\n",
      "70 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "69 bottle of beer on the wall.\n",
      "\n",
      "69 bottle of beer on the wall.\n",
      "69 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "68 bottle of beer on the wall.\n",
      "\n",
      "68 bottle of beer on the wall.\n",
      "68 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "67 bottle of beer on the wall.\n",
      "\n",
      "67 bottle of beer on the wall.\n",
      "67 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "66 bottle of beer on the wall.\n",
      "\n",
      "66 bottle of beer on the wall.\n",
      "66 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "65 bottle of beer on the wall.\n",
      "\n",
      "65 bottle of beer on the wall.\n",
      "65 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "64 bottle of beer on the wall.\n",
      "\n",
      "64 bottle of beer on the wall.\n",
      "64 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "63 bottle of beer on the wall.\n",
      "\n",
      "63 bottle of beer on the wall.\n",
      "63 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "62 bottle of beer on the wall.\n",
      "\n",
      "62 bottle of beer on the wall.\n",
      "62 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "61 bottle of beer on the wall.\n",
      "\n",
      "61 bottle of beer on the wall.\n",
      "61 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "60 bottle of beer on the wall.\n",
      "\n",
      "60 bottle of beer on the wall.\n",
      "60 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "59 bottle of beer on the wall.\n",
      "\n",
      "59 bottle of beer on the wall.\n",
      "59 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "58 bottle of beer on the wall.\n",
      "\n",
      "58 bottle of beer on the wall.\n",
      "58 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "57 bottle of beer on the wall.\n",
      "\n",
      "57 bottle of beer on the wall.\n",
      "57 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "56 bottle of beer on the wall.\n",
      "\n",
      "56 bottle of beer on the wall.\n",
      "56 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "55 bottle of beer on the wall.\n",
      "\n",
      "55 bottle of beer on the wall.\n",
      "55 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "54 bottle of beer on the wall.\n",
      "\n",
      "54 bottle of beer on the wall.\n",
      "54 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "53 bottle of beer on the wall.\n",
      "\n",
      "53 bottle of beer on the wall.\n",
      "53 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "52 bottle of beer on the wall.\n",
      "\n",
      "52 bottle of beer on the wall.\n",
      "52 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "51 bottle of beer on the wall.\n",
      "\n",
      "51 bottle of beer on the wall.\n",
      "51 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "50 bottle of beer on the wall.\n",
      "\n",
      "50 bottle of beer on the wall.\n",
      "50 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "49 bottle of beer on the wall.\n",
      "\n",
      "49 bottle of beer on the wall.\n",
      "49 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "48 bottle of beer on the wall.\n",
      "\n",
      "48 bottle of beer on the wall.\n",
      "48 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "47 bottle of beer on the wall.\n",
      "\n",
      "47 bottle of beer on the wall.\n",
      "47 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "46 bottle of beer on the wall.\n",
      "\n",
      "46 bottle of beer on the wall.\n",
      "46 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "45 bottle of beer on the wall.\n",
      "\n",
      "45 bottle of beer on the wall.\n",
      "45 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "44 bottle of beer on the wall.\n",
      "\n",
      "44 bottle of beer on the wall.\n",
      "44 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "43 bottle of beer on the wall.\n",
      "\n",
      "43 bottle of beer on the wall.\n",
      "43 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "42 bottle of beer on the wall.\n",
      "\n",
      "42 bottle of beer on the wall.\n",
      "42 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "41 bottle of beer on the wall.\n",
      "\n",
      "41 bottle of beer on the wall.\n",
      "41 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "40 bottle of beer on the wall.\n",
      "\n",
      "40 bottle of beer on the wall.\n",
      "40 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "39 bottle of beer on the wall.\n",
      "\n",
      "39 bottle of beer on the wall.\n",
      "39 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "38 bottle of beer on the wall.\n",
      "\n",
      "38 bottle of beer on the wall.\n",
      "38 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "37 bottle of beer on the wall.\n",
      "\n",
      "37 bottle of beer on the wall.\n",
      "37 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "36 bottle of beer on the wall.\n",
      "\n",
      "36 bottle of beer on the wall.\n",
      "36 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "35 bottle of beer on the wall.\n",
      "\n",
      "35 bottle of beer on the wall.\n",
      "35 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "34 bottle of beer on the wall.\n",
      "\n",
      "34 bottle of beer on the wall.\n",
      "34 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "33 bottle of beer on the wall.\n",
      "\n",
      "33 bottle of beer on the wall.\n",
      "33 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "32 bottle of beer on the wall.\n",
      "\n",
      "32 bottle of beer on the wall.\n",
      "32 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "31 bottle of beer on the wall.\n",
      "\n",
      "31 bottle of beer on the wall.\n",
      "31 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "30 bottle of beer on the wall.\n",
      "\n",
      "30 bottle of beer on the wall.\n",
      "30 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "29 bottle of beer on the wall.\n",
      "\n",
      "29 bottle of beer on the wall.\n",
      "29 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "28 bottle of beer on the wall.\n",
      "\n",
      "28 bottle of beer on the wall.\n",
      "28 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "27 bottle of beer on the wall.\n",
      "\n",
      "27 bottle of beer on the wall.\n",
      "27 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "26 bottle of beer on the wall.\n",
      "\n",
      "26 bottle of beer on the wall.\n",
      "26 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "25 bottle of beer on the wall.\n",
      "\n",
      "25 bottle of beer on the wall.\n",
      "25 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "24 bottle of beer on the wall.\n",
      "\n",
      "24 bottle of beer on the wall.\n",
      "24 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "23 bottle of beer on the wall.\n",
      "\n",
      "23 bottle of beer on the wall.\n",
      "23 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "22 bottle of beer on the wall.\n",
      "\n",
      "22 bottle of beer on the wall.\n",
      "22 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "21 bottle of beer on the wall.\n",
      "\n",
      "21 bottle of beer on the wall.\n",
      "21 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "20 bottle of beer on the wall.\n",
      "\n",
      "20 bottle of beer on the wall.\n",
      "20 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "19 bottle of beer on the wall.\n",
      "\n",
      "19 bottle of beer on the wall.\n",
      "19 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "18 bottle of beer on the wall.\n",
      "\n",
      "18 bottle of beer on the wall.\n",
      "18 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "17 bottle of beer on the wall.\n",
      "\n",
      "17 bottle of beer on the wall.\n",
      "17 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "16 bottle of beer on the wall.\n",
      "\n",
      "16 bottle of beer on the wall.\n",
      "16 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "15 bottle of beer on the wall.\n",
      "\n",
      "15 bottle of beer on the wall.\n",
      "15 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "14 bottle of beer on the wall.\n",
      "\n",
      "14 bottle of beer on the wall.\n",
      "14 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "13 bottle of beer on the wall.\n",
      "\n",
      "13 bottle of beer on the wall.\n",
      "13 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "12 bottle of beer on the wall.\n",
      "\n",
      "12 bottle of beer on the wall.\n",
      "12 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "11 bottle of beer on the wall.\n",
      "\n",
      "11 bottle of beer on the wall.\n",
      "11 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "10 bottle of beer on the wall.\n",
      "\n",
      "10 bottle of beer on the wall.\n",
      "10 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "9 bottle of beer on the wall.\n",
      "\n",
      "9 bottle of beer on the wall.\n",
      "9 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "8 bottle of beer on the wall.\n",
      "\n",
      "8 bottle of beer on the wall.\n",
      "8 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "7 bottle of beer on the wall.\n",
      "\n",
      "7 bottle of beer on the wall.\n",
      "7 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "6 bottle of beer on the wall.\n",
      "\n",
      "6 bottle of beer on the wall.\n",
      "6 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "5 bottle of beer on the wall.\n",
      "\n",
      "5 bottle of beer on the wall.\n",
      "5 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "4 bottle of beer on the wall.\n",
      "\n",
      "4 bottle of beer on the wall.\n",
      "4 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "3 bottle of beer on the wall.\n",
      "\n",
      "3 bottle of beer on the wall.\n",
      "3 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "2 bottle of beer on the wall.\n",
      "\n",
      "2 bottle of beer on the wall.\n",
      "2 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "1 bottle of beer on the wall.\n",
      "\n",
      "1 bottle of beer on the wall.\n",
      "1 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "No more bottles of beer on the wall.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "word = \"bottle\"\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num, word, \"of beer on the wall.\")\n",
    "    print(beer_num, word, \"of beer.\")\n",
    "    print(\"Take one down.\")\n",
    "    print(\"Pass it around.\")\n",
    "    if beer_num == 1:\n",
    "        print(\"No more bottles of beer on the wall.\")\n",
    "    else:\n",
    "        new_num = beer_num - 1\n",
    "        if new_num == 1:\n",
    "            word = \"bottle\"\n",
    "        print(new_num, word,\"of beer on the wall.\" )\n",
    "    print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "33e82021",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f2e7d8f3",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fd639858",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
